<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="copyright" content="All Rights Reserved, Copyright (C) 2017, whatever_wherever@163.com, Ltd." />
    <title>坭兴陶制品库存管理系统</title>
    <link rel="stylesheet" type="text/css" href="/easyui/1.5/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="/easyui/1.5/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="/css/wu.css" />
    <link rel="stylesheet" type="text/css" href="/css/icon.css" />
    <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/js/common.js"></script>
    <script type="text/javascript" src="/layer/layer.js"></script>
    <script type="text/javascript" src="/js/public.js"></script>
    <script type="text/javascript" src="/easyui/1.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/easyui/1.5/locale/easyui-lang-zh_CN.js"></script>
</head>
<body class="easyui-layout">
<div class="wu-header" data-options="region:'north',border:false,split:true">
    <div class="wu-header-left">
        <h1>坭兴陶制品库存管理系统</h1>
    </div>
    <div class="wu-header-right">
        <p>
            <strong>admin</strong>，欢迎您！|
            <#--<a onclick="logout()">安全退出</a>-->
            <a href="#" class="easyui-linkbutton" onclick="logout()" data-options="plain:true">安全退出</a>
        </p>
    </div>
</div>
<div class="wu-sidebar" data-options="region:'west',split:true,border:true,title:'导航菜单'">
    <ul id="tt"/>
</div>
<div class="wu-main" data-options="region:'center'">
    <div id="wu-tabs" class="easyui-tabs" data-options="border:false,fit:true">
    </div>
</div>
<div class="wu-footer" data-options="region:'south',border:true,split:true">
    &copy; 2017 powered by 曹丽雯 钦州学院毕业设计
</div>
<script type="text/javascript">
    $(function(){
        var content = '<iframe scrolling="auto" frameborder="0" data-options=""  src="/main/home" style="width:100%;height:100%;"></iframe>';
        $('#wu-tabs').tabs('add',{
            title:'首页',
            content:content,
            fit:true,
            cls:'pd3',
            closable:false
        });
    });

    $('#tt').tree({
        url:'/feature/getData',
        cache:false,
        method:'get',
        loadFilter: function(rows){
            return convertFeatures(rows);
        },
        onClick:function(node){
            var url = node.attributes['url'];
            if(url==null || url == ""){
                return false;
            }
            else{
                addTab(node.text, url, '', true);
            }
        }
    });

    /**
     * Name 添加菜单选项
     * Param title 名称
     * Param href 链接
     * Param iconCls 图标样式
     * Param iframe 链接跳转方式（true为iframe，false为href）
     */
    function addTab(title, href, iconCls, iframe){
        var tabPanel = $('#wu-tabs');
        if(!tabPanel.tabs('exists',title)){
            var content = '<iframe scrolling="auto" frameborder="0"  src="'+ href +'" style="width:100%;height:100%;"></iframe>';
            if(iframe){
                tabPanel.tabs('add',{
                    title:title,
                    content:content,
                    iconCls:iconCls,
                    fit:true,
                    cls:'pd3',
                    closable:true
                });
            }
            else{
                tabPanel.tabs('add',{
                    title:title,
                    href:href,
                    iconCls:iconCls,
                    fit:true,
                    cls:'pd3',
                    closable:true
                });
            }
        }
        else
        {
            tabPanel.tabs('select',title);
        }
    }
    /**
     * Name 移除菜单选项
     */
//    function removeTab(){
//        var tabPanel = $('#wu-tabs');
//        var tab = tabPanel.tabs('getSelected');
//        if (tab){
//            var index = tabPanel.tabs('getTabIndex', tab);
//            tabPanel.tabs('close', index);
//        }
//    }

    function logout() {
        var index = com.msg_load();
        $.ajax({
            type: "POST",
            url: "/logout",
            success: function (data) {
                com.msg_load_close(index);
                var d = eval(data);
                if (data != null && d.msg == 'success') {
                    com.msg_success("退出成功，正在跳转登录界面");
                    setTimeout('location.href="/"', 2000);
                } else {
                }
            }
        });
    }
</script>
</body>
</html>
